<H2><?php echo __("Manage Comments")?></H2>
<BR><BR>
<?php echo $form->create('Comment', array('action'=>'admin_search','class'=>'Search_Form'));?>
<?php echo $form->input('keyword', array('label'=>'SEARCH '));?>
<?php echo $form->end(__('Go'));?>
<div class="filter">
<?php
echo $form->input('filter', array('label'=>'Show Comments ','onchange'=>'filterByDate()','id'=>'filter','type'=>'select','options'=>getTimeFilter()));?>
</div>
<?php if(empty($comments))
		echo '<H3>SORRY, NO COMMENTS PRESENT</H3>';
		else{?>
<?php echo $paginator->counter(" Showing page %page% of %pages% ");?>
<table cellpadding="0" cellspacing="0">
<th>Id</th>
<th width="250"><?php echo __("Post")?></th>
<th width="300"><?php echo __("Comment")?></th>
<th width="80"><?php echo __("Added By")?> </th>
<th><?php echo __("Status")?></th>
<th width="220"><?php echo __("Actions")?></th>
<?php $i = 1;?>
<?php foreach($comments as $comment){?>
<?php if($i%2==0){?><tr class="odd"><?php }else{?><tr class="even"><?php }?>
<td><?php echo $comment['Post']['id'] ?></td>
<td><?php echo $comment['Post']['title'] ?></td>
<td><?php $body=$comment['Comment']['body'];
	echo substr($body, 0, 100).'...';?>	
</td>	
	
<td><?php 	echo  $comment['User']['name'] ?></td>

<?php $backend->setItem($comment, 'Comment');?>
<td><?php echo $backend->showStatus();?></td>

<td><?php echo $backend->actions('view', 'approve', 'edit', 'delete');?></td>
</tr>
<?php $i++?>
<?php
} ?>
</table>
<?php echo $paginator->prev();?>
<?php echo $paginator->numbers();?>
<?php echo $paginator->next()?>
<?php }?>
<script>
function filterByDate(){
window.location = URL+'admin/comments/filterDate/filter:'+$('#filter').val();}
</script>